<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""DTD/xhtml1-strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@taglib uri="/WEB-INF/fmt.tld" prefix="fmt"%>
<%@taglib uri="/WEB-INF/el.tld" prefix="el"%>
<%@taglib uri="/WEB-INF/fn.tld" prefix="fn"%>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title></title>
		<c:import url="/includes/css_inc.jsp"/>
		<c:import url="/includes/js_inc.jsp"/>
		<script>
		$(function(){
			$("#btnSave").button({
	            icons: {
	                primary: "ui-icon-disk"
	            }
			}).click(function(){
				$("#saveForm").submit();
			});

			$("#btnExport").button({
	            icons: {
	                primary: "ui-icon-arrowthickstop-1-s"
	            }
			}).click(function(){
				window.location='${pageContext.request.contextPath}/acc6?app=ACC60302&job=export&docNo='+$("#docNo").val();
			});
			$("#btnPrint").button({
	            icons: {
	                primary: "ui-icon-print"
	            }
			}).click(function(){ 
				window.location='${pageContext.request.contextPath}/acc6?app=ACC60302&job=print2&docNo='+$("#docNo").val()+'&budgetYear='+$("#budgetYear").val()+'&provinceId='+$("#provinceId").val();
			});
			$("#btnPrint2").button({
	            icons: {
	                primary: "ui-icon-print"
	            }
			}).click(function(){
				window.location='${pageContext.request.contextPath}/acc6?app=ACC60302&job=print&docNo='+$("#docNo").val()+'&budgetYear='+$("#budgetYear").val()+'&provinceId='+$("#provinceId").val();
			});
			$("[name=btnCopy]").button({
	            icons: {
	                primary: "ui-icon-copy"
	            },
	            text : false
			}).click(function(){
			});
			
			$("[name=btnDel]").button({
	            icons: {
	                primary: "ui-icon-closethick"
	            },
	            text : false
			});
			
			$("#btnAdd").button({
	            icons: {
	                primary: "ui-icon-plusthick"
	            }
			}).click(function() {
			});
				
				$("#btnBack").button({
		            icons: {
		                primary: "ui-icon-arrowreturnthick-1-w"
		            }
				}).click(function(){
					$("#job").val("back");
					$("#saveForm").submit();
				});
		});
		</script>
	</head>
	<body>
		<c:import url="/apps/msg.jsp"/>
		<form class="acc67-form" name="saveForm" id="saveForm" action="${pageContext.request.contextPath}/acc6" method="post">
		<input type="hidden" name="app" id="app" value="ACC60302"/>
		<input type="hidden" name="job" id="job" value="${job}"/>
		<input type="hidden" name="docNo" id="docNo" value="${docNo}"/>
		<input type="hidden" name="budgetYear" id="budgetYear" value="${expenseBean.budgetYear}"/>
		<input type="hidden" name="provinceId" id="provinceId" value="${expenseBean.provinceId}"/>
		<table width="100%" class="ui-widget ui-widget-content" border="0">
			<tr>
				<th align="left" class="acc67-header ui-widget-header" colspan="2"><b>${screenCode.ACC60302}</b></th>
			</tr>
			<tr>
				<td class="bold" width="15%">เลขที่เอกสาร : </td>
				<td>${docNo}</td>
			</tr>
			<tr>
				<td class="bold">จังหวัด : </td>
				<td>${provinceName}</td>
			</tr>
			<tr>
				<td class="bold">ปีงบประมาณ : </td>
				<td>${expenseBean.budgetYear}</td>
			</tr>
			<tr>
				<td class="bold">วันที่ทำรายการ : </td>
				<td>${el:dateTh(expenseBean.createdDate)}</td>
			</tr>
			<%-- <tr>
				<td class="bold">วันที่จ่าย : </td>
				<td>${el:dateTh(expenseBean.expenseDate)}</td>
			</tr> --%>
			<tr>
				<td class="bold">ชื่อการจ่าย : </td>
				<td>${expenseBean.expenseSubject}</td>
			</tr>
			<tr>
				<td class="bold" valign="top">คำอธิบายการจ่าย : </td>
				<td>${expenseBean.expenseDesc}</td>
			</tr>
			<tr>
				<td colspan="2">
					<fieldset id="payDetail">
						<legend>รายละเอียดการจ่าย cheque</legend>
						<table width="100%" class="acc67-grid ui-widget ui-widget-content" id="payTableDetail">
							<tr>
								<th align="center" class="ui-state-default" width="7%">เอกสารอ้างอิง</th>
								<th align="center" class="ui-state-default" width="9%">กองทุนย่อยเฉพาะด้าน</th>
								<th align="center" class="ui-state-default" width="9%">หน่วยบริการ/คู่สัญญา</th>
								<th align="center" class="ui-state-default" width="5%">เลขที่ cheque</th>
								<th align="center" class="ui-state-default" width="5%">วันที่สั่งจ่าย</th>
								<th align="center" class="ui-state-default" width="5%">วันที่ขึ้นเงิน</th>
								<th align="center" class="ui-state-default" width="9%">หมวดการจ่าย</th>
								<th align="center" class="ui-state-default" width="7%">จำนวนเงิน</th>
								<th align="center" class="ui-state-default" width="5%">ภาษี</th>
								<th align="center" class="ui-state-default" width="9%">ชื่อผู้รับผิดชอบ</th> 
								<th align="center" class="ui-state-default">ชื่อโครงการ/คำอธิบาย</th>
								<th align="center" class="ui-state-default" width="5%">เงินยืม</th>
							</tr>
							<c:if test="${!empty listExpenseCheque}">
								<c:forEach items="${listExpenseCheque}" var="data" varStatus="x">
										<c:set var="reasonDesc" value="${el:getReasonDesc(data.transactionTimestamp)}" />
										<c:if test="${reasonDesc == '00:SUCCESS'}">
										<tr style="background-color: #8eee81;">
										</c:if>
										<c:if test="${reasonDesc == ''}">
											<tr>
										</c:if>
										<c:if test="${reasonDesc != '00:SUCCESS' && reasonDesc != ''}">
											<tr style="background-color: red;" title="${reasonDesc}">
										</c:if>
											<td align="center">${data.refNo}</td>
											<td align="left"><span title="${data.allocateName}">${data.allocateCode} : ${data.allocateSub}</span></td>
											<td align="left"><span title="${data.venderName}">${data.venderSub}</span></td>
											<td align="center">${data.chequeNo}</td>
											<td align="center">${el:dateTh(data.chequeDate)}</td>
											<td align="center">${el:dateTh(data.chequeReceivingDate)}</td>
											<td align="left">
												<c:if test="${fn:length(el:getDataUtil('CAT',data.categoryId)) > 10}">
													<span title="${el:getDataUtil('CAT',data.categoryId)}">${fn:substring(el:getDataUtil('CAT',data.categoryId),0,10)}...</span>
												</c:if>
												<c:if test="${fn:length(el:getDataUtil('CAT',data.categoryId)) <= 10}">
													<span title="${el:getDataUtil('CAT',data.categoryId)}">${el:getDataUtil('CAT',data.categoryId)}</span>
												</c:if>
											</td>
											<td align="right"><fmt:formatNumber pattern="#,##0.00" value="${data.chequeAmount}" /></td>
											<td align="right"><fmt:formatNumber pattern="#,##0.00" value="${data.taxValue}" /></td>
											<td align="left">${data.responsibleName}</td>
											<td align="left">${data.chequeDesc}</td>
											<td align="center">
												<input type="checkbox" ${data.isBorrow=='Y'?'checked':''} disabled="disabled"/>
											</td>
										</tr>
								</c:forEach>
							</c:if>
						</table>
					</fieldset>
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center">
					<c:if test="${expenseBean.expenseStatus == 'A' && userInfo.areaLevel!='2'}">
						<button type="button" name="btnPrint" id="btnPrint" class="acc67-button">พิมพ์หนังสือขออนุมัติจ่ายเช็ค</button>
						<button type="button" name="btnPrint2" id="btnPrint2" class="acc67-button">พิมพ์หนังสือจ่ายเช็ค</button>
					</c:if>
					<button type="button" name="btnExport" id="btnExport" class="acc67-button">Download</button>
					<button type="button" name="btnBack" id="btnBack" class="acc67-button">ย้อนกลับ</button>
				</td>
			</tr>
		</table>
		</form>
	</body>
</html>